/* ================================================================================
//	Crypteviant!
//	Providing tough encrypted P2P Chat
//	Copyright (C) 2010  Martin Pfeifer, Tobias Rausch
//
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
// ============================================================================== */

#ifndef TIMERUNIX_HPP
#define TIMERUNIX_HPP

#include <QtCore/QObject>

#include "abstracttimer.hpp"
#include "highrestimerunix.hpp"
#include "standardtimerunix.hpp"



namespace Timer {

    /**
     * @brief Timer class for Unix
     * @details Implementation specific for Unix. Uses OS specific timers.\n
     * Will automatically use the one with highest resolution
     *
     * @class TimerUnix timerunix.hpp "timerunix.hpp"
    */
    class TimerUnix : public AbstractTimer
    {
        Q_OBJECT
    public:
        /**
         * @brief Default Constructor
         *
         * @fn TimerUnix(QObject*)
         * @param parent
        */
        explicit TimerUnix(QObject *parent = 0);

        /**
         * @brief Get the current Time
         *
         * @fn getCurrentTime() const
         * @return unsigned long
        */
        unsigned long getCurrentTime() const;

    public slots:
        /**
         * @brief Start the Timer
         * @details This will store the current time in m_startTime. m_stopTime will be cleared.\n
         * The signal \ref AbstractTimer::started(unsigned long) will be emitted
         *
         * @fn start
        */
        void start();

        /**
         * @brief Stop the Timer
         * @details This will store the current time in m_stopTime\n
         * The signals \ref AbstractTimer::stopped(unsigned long) and \ref AbstractTimer::stopped(unsigned long, unsigned long) are emitted
         *
         * @fn stop
        */
        void stop();

    private:
        /**
         * @var m_useHighResolution
         * @details Representing the present state of an high resolution timer
        */
        bool m_useHighResolution;

    };

} // End of Namespace Timer

#endif // TIMERUNIX_HPP
